package com.lee.lease.common.custom.exception;

import com.lee.lease.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * ClassName: LeaseException
 * Package: com.lee.lease.common.custom.exception
 * Description:
 */
@Data
public class LeaseException extends RuntimeException {
    private Integer code;

    public LeaseException (String message, Integer code){
        super(message);
        this.code = code;
    }

    public LeaseException (ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    @Override
    public String toString() {
        return "LeaseException{" +
                "code=" + code +
                ", message=" + this.getMessage()+
                '}';
    }
}
